﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.Composition;
using Core.BusinessLogic.Interfaces;
using Core.Common;
using Core.DataAccess.IRepositories;
using Core.DataAccess;

namespace Core.BusinessLogic
{
    [Export(typeof(IMessageChatService))]
    public class MessageChatService : IMessageChatService
    {
        [Import]
        private IMessageChatRepository _messageChatRepository;

        public MessageChatService()
        {
            MEFManager.Compose(this);
        }

        public void SaveMessageChat(MessageChat messageChat)
        {
            _messageChatRepository.SaveMessageChat(messageChat);
        }

        public List<MessageChat> GetMessageChatByAccountID(int currentID, int chatToID)
        {
            return _messageChatRepository.GetMessageChatByAccountID(currentID, chatToID);
        }

        public int CountMessageChatUnReadByAccountID(int accountID)
        {
            return _messageChatRepository.CountMessageChatUnReadByAccountID(accountID);
        }

        public List<MessageChat> GetMessageChatByAccountID(int accountID)
        {
            return _messageChatRepository.GetMessageChatByAccountID(accountID);
        }

        public void UpdateMessageChatIsRead(int MessageChatID)
        {
            _messageChatRepository.UpdateMessageChatIsRead(MessageChatID);
        }

        public void DeleteMessageChatByAccountID(int accountID, int friendID)
        {
            _messageChatRepository.DeleteMessageChatByAccountID(accountID,friendID);
        }
    }
}
